<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table>
    <tr>
        <td><input type="number"  id="num" ></td>
        <td><button onclick="clickMe()">猜</button></td>
        <td><span id="spanId">???</span></td>
    </tr>
    <tr>
        <td><input id="result"></input></td>
    </tr>
</table>
<script type="text/javascript">
    var random = parseInt(Math.random() * 100 + 1);
    function clickMe(){
        var spanObj =document.getElementById('spanId')
        var resultObj =document.getElementById('result')
        var num = document.getElementById('num');
        document.getElementById("result").value = random;
        num = parseInt(num.value);
        if (random > num && num >= 0){
            spanObj.innerHTML ='小了'
        } else if (random < num && num <= 100){
            spanObj.innerHTML ='大了'
        } else if(num == random){
            spanObj.innerHTML ='对了'
        } else {
            spanObj.innerHTML ='输入非法，请重新输入'
        }

    }
</script>
</body>
</html>